package com.breezelin.freshmarket.entities.req;

/**
 * Created by Breeze Lin
 * 10:26 2016/5/15
 * 1linyufeng1@gmail.com
 */

import com.breezelin.freshmarket.entities.JsonStruct;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 查询操作数据体
 */
public class QueryReq implements JsonStruct {

	// TODO: 2016/5/15 探知sort的类型

	/**
	 * 排序方式
	 */
	private String sort;
	/**
	 * todo 未知目录标识字段
	 */
	private String categoryCode;
	/**
	 * 关键字
	 */
	private String keyword;
	/**
	 * 类别id
	 */
	private String categoryId;

	public QueryReq() {
		sort = "1";
		categoryCode = "";
		keyword = "";
		categoryId = "";
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public String getCategoryCode() {
		return categoryCode;
	}

	public void setCategoryCode(String categoryCode) {
		this.categoryCode = categoryCode;
	}

	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	public String getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(String categoryId) {
		this.categoryId = categoryId;
	}

	@Override
	public void fromJson(JSONObject jsonObject) {
	}

	@Override
	public JSONObject toJson() {
		JSONObject ret = new JSONObject();
		try {
			ret.put("Sort", sort);
			ret.put("CategoryCode", categoryCode);
			ret.put("Keyword", keyword);
			ret.put("CategoryId", categoryId);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return ret;
	}
}
